﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGRapidForm.Foundation.Service.Interface;
using SGRapidForm.Foundation.Component;
using SGRapidForm.Foundation.Entity;
using Microsoft.Practices.Unity;

namespace SGRapidForm.Foundation.Service
{
    public partial class FoundationService : IFoundationService
    {
        [Dependency]
        public FoundationComponet FoundationComponet
        { get; set; }

        public bool AddFoundation(FoundationEntity FoundationDetails)
        {
            return this.FoundationComponet.Add(FoundationDetails);
        }

        public bool DeleteByFouKeyid(string keyid)
        {
          return  this.FoundationComponet.DeleteByFouKeyid(keyid);
        }

        public bool DeleteFoundation(string keyid)
        {
            return this.FoundationComponet.Delete(keyid);
        }

        public bool UpdateFoundation(FoundationEntity FoundationDetails)
        {
            return this.FoundationComponet.Update(FoundationDetails);
        }

        public List<FoundationEntity> GetFoundationList()
        {
            return this.FoundationComponet.GetAll();
        }

        public List<FoundationEntity> PagingGetFoundation(int startRecord, int maxRecords, string sortColumns, string filterConditions)
        {
            return this.FoundationComponet.PagingGet(startRecord, maxRecords, sortColumns, filterConditions);
        }

        public int PagingGetFoundationCount(string filterConditions)
        {
            return this.FoundationComponet.PagingGetCount(filterConditions);
        }

        public FoundationEntity GetFoundationByKeyid(string keyid)
        {
            return this.FoundationComponet.GetByKeyid(keyid);
        }
        /// <summary>
        /// 根据基础资料类别的keyid 
        /// </summary>
        /// <param name="keyid">keyid</param>
        /// <returns>对应的类别的所有集合</returns>
        public List<FoundationEntity> GetByFoundationClassKeyid(string keyid)
        {
            return this.FoundationComponet.GetByFoundationClassKeyid(keyid);
        }

        /// <summary>
        /// 批量删除用户
        /// </summary>
        public bool BulkDeleteFoundation(string keyids)
        {
            return this.FoundationComponet.BulkDelete(keyids);
        }

        /// <summary>
        /// 根据过滤条件查询
        /// </summary>
        /// <param name="filterConditions">条件值</param>
        /// <returns>查询的集合</returns>
        public List<FoundationEntity> DoSelectByFoundation(string fieldconditions)
        {
            return this.FoundationComponet.DoSelectByFoundation(fieldconditions);
        }

        public List<FoundationEntity> GetAll()
        {
            return this.FoundationComponet.GetAll();
        }

        public List<FoundationEntity> GetFoundationByClassCode(string classCode)
        {
           return this.FoundationComponet.GetFoundationByClassCode(classCode);
        }
    }
}
